import os
import Image

def to_one_folder():
    img_folder1 = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/JD/Proc/test_UFS_fixed'
    img_folder2 = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/JD/Proc/test_washed_FS'
    res_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/JD/Proc/Test_all'
    flag = 0
    for img in os.listdir(img_folder1):
        flag += 1
        path = img_folder1 + '/' + img
        path_save = res_folder + '/' + img
        im = Image.open(path)
        im.save(path_save)
        print 'img_folder1: ' + str(flag) + '\r',

    flag = 0
    for img in os.listdir(img_folder2):
        flag += 1
        path = img_folder2 + '/' + img
        path_save = res_folder + '/' + img
        im = Image.open(path)
        im.save(path_save)
        print 'img_folder2: ' + str(flag) + '\r',

if __name__ == '__main__':
    to_one_folder()